package com.ucode.hrm.service;

import cn.hutool.core.util.ObjectUtil;
import com.ucode.hrm.mapper.HrmAttendanceConfigMapper;
import com.ucode.model.hrm.HrmAttendanceConfig;
import com.ucode.model.hrm.enums.HrmSysResultCodeEnum;
import com.ucode.springboot.starter.mybatis.core.base.BaseService;
import com.ucode.tool.exception.UcodeServiceException;

/**
 * 考勤打开配置表Service
 * @Author: liliang
 * @Date: 2025/8/21 0:10
 * @Version: 1.0
 */
public interface HrmAttendanceConfigService extends BaseService<Long, HrmAttendanceConfig , HrmAttendanceConfigMapper> {

    public default HrmAttendanceConfig validate(Long id){
        if(ObjectUtil.isNull(id) )
            throw new UcodeServiceException(HrmSysResultCodeEnum.ATTENDANCECONFIG_NOT_EXITS);
        //验证数据是否存在
        HrmAttendanceConfig bean = this.selectByPrimaryKey(id);
        if(ObjectUtil.isNull(bean) || bean.getDeltag()){
            throw new UcodeServiceException(HrmSysResultCodeEnum.ATTENDANCECONFIG_NOT_EXITS);
        }
        return bean;
    }

}
